/**
 *  iBizSys 5.0 机器人生产代码（不要直接修改当前代码）
 *  http://www.ibizsys.net
 */
package com.sa.ibiz.demo.srv.demo.service;


import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Component;
import net.ibizsys.paas.exception.ErrorException;
import net.ibizsys.paas.core.PluginActionResult;
import net.ibizsys.paas.core.IDataEntity;
import net.ibizsys.paas.core.IDEDataSetFetchContext;
import net.ibizsys.paas.db.DBCallResult;
import net.ibizsys.paas.db.DBFetchResult;
import net.ibizsys.paas.db.IProcParam;
import net.ibizsys.paas.util.StringHelper;
import net.ibizsys.paas.util.StringBuilderEx;
import net.ibizsys.paas.core.Errors;
import net.ibizsys.paas.core.ActionContext;
import net.ibizsys.paas.data.DataObject;
import net.ibizsys.paas.service.ServiceGlobal;
import net.ibizsys.paas.entity.IEntity;
import net.ibizsys.paas.demodel.IDataEntityModel;
import net.ibizsys.paas.demodel.DEModelGlobal;
import net.ibizsys.paas.demodel.IDELogicModel;
import net.ibizsys.paas.dao.DAOGlobal;
import net.ibizsys.paas.web.WebContext;
import net.ibizsys.paas.service.IService;
import net.ibizsys.paas.util.DataTypeHelper;
import net.ibizsys.paas.util.KeyValueHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import net.ibizsys.paas.db.SelectCond;
import net.ibizsys.paas.service.IServiceWork;
import net.ibizsys.paas.service.IServicePlugin;
import net.ibizsys.paas.service.ITransaction;
import net.ibizsys.paas.dao.IDAO;
import net.ibizsys.paas.service.CloneSession;
import net.ibizsys.paas.service.ServiceBase;
import net.ibizsys.paas.entity.EntityFieldError;
import net.ibizsys.paas.entity.EntityError;
import java.sql.Timestamp;
import net.ibizsys.paas.util.DefaultValueHelper;
import javax.annotation.PostConstruct;
import net.ibizsys.paas.service.IDataContextParam;
import net.sf.json.JSONObject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


import com.sa.ibiz.demo.srv.demo.service.IBZ5CUSTOMERMG2Service;
import com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMERMG2;

import com.sa.ibiz.demo.srv.demo.entity.IBZ5ACCOUNT;
import com.sa.ibiz.demo.srv.demo.dao.IBZ5ACCOUNTDAO;
import com.sa.ibiz.demo.srv.demo.demodel.IBZ5ACCOUNTDEModel;


/**
 * 实体[IBZ5ACCOUNT] 服务对象基类
 */
@Component
public class IBZ5ACCOUNTService extends com.sa.ibiz.demo.srv.MyTestSysSysServiceBase<IBZ5ACCOUNT> {
    private static final Log log = LogFactory.getLog(IBZ5ACCOUNTService.class);
    /**
     * 实体数据集合[DEFAULT]标识
     */
    public final static String DATASET_DEFAULT = "DEFAULT";


    public IBZ5ACCOUNTService () {
        super();

    }

    /**
     * 获取实体[IBZ5ACCOUNT]服务对象
     * @param sessionFactory
     * @return
     * @throws Exception
     */
    public static IBZ5ACCOUNTService getInstance() throws Exception {
        return getInstance(null);
    }

    /**
     * 获取实体[IBZ5ACCOUNT]服务对象
     * @param sessionFactory
     * @return
     * @throws Exception
     */
    public static IBZ5ACCOUNTService getInstance(SessionFactory sessionFactory) throws Exception {
        return (IBZ5ACCOUNTService)ServiceGlobal.getService(IBZ5ACCOUNTService.class, sessionFactory);
    }

    /**
     * Spring注册后执行构造处理
     * @throws Exception
     */
    @PostConstruct
    public void postConstruct() throws Exception {
        ServiceGlobal.registerService(getServiceId(), this);
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#getServiceId()
     */
    @Override
    protected String getServiceId() {
        return "com.sa.ibiz.demo.srv.demo.service.IBZ5ACCOUNTService";
    }

    private IBZ5ACCOUNTDEModel iBZ5ACCOUNTDEModel;
    /**
     * 获取实体[IBZ5ACCOUNT]模型对象
     */
    public  IBZ5ACCOUNTDEModel getIBZ5ACCOUNTDEModel() {
        if(this.iBZ5ACCOUNTDEModel==null) {
            try {
                this.iBZ5ACCOUNTDEModel = (IBZ5ACCOUNTDEModel)DEModelGlobal.getDEModel("com.sa.ibiz.demo.srv.demo.demodel.IBZ5ACCOUNTDEModel");
            } catch(Exception ex) {
            }
        }
        return this.iBZ5ACCOUNTDEModel;
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#getDEModel()
     */
    @Override
    public  IDataEntityModel getDEModel() {
        return this.getIBZ5ACCOUNTDEModel();
    }


    private IBZ5ACCOUNTDAO iBZ5ACCOUNTDAO;

    /**
     * 获取实体[IBZ5ACCOUNT]数据操作对象
     */
    public  IBZ5ACCOUNTDAO getIBZ5ACCOUNTDAO() {
        if(this.iBZ5ACCOUNTDAO==null) {
            try {
                this.iBZ5ACCOUNTDAO= (IBZ5ACCOUNTDAO)DAOGlobal.getDAO("com.sa.ibiz.demo.srv.demo.dao.IBZ5ACCOUNTDAO",this.getSessionFactory());
            } catch(Exception ex) {
            }
        }
        return this.iBZ5ACCOUNTDAO;
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.IService#getDAO()
     */
    @Override
    public  IDAO getDAO() {
        return this.getIBZ5ACCOUNTDAO();
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onfetchDataSet(java.lang.String, net.ibizsys.paas.core.IDEDataSetFetchContext)
     */
    @Override
    protected DBFetchResult onfetchDataSet(String strDataSetName,IDEDataSetFetchContext iDEDataSetFetchContext) throws Exception {
        if(StringHelper.compare(strDataSetName,DATASET_DEFAULT,true)==0) {
            return this.fetchDefault(iDEDataSetFetchContext);
        }
        return super.onfetchDataSet(strDataSetName,iDEDataSetFetchContext);
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onExecuteAction(java.lang.String, net.ibizsys.paas.entity.IEntity)
     */
    @Override
    protected  void onExecuteAction(String strAction,IEntity entity) throws Exception {
        super.onExecuteAction(strAction,entity);
    }

    /**
     * 获取数据集合[DEFAULT]
     * @param iDEDataSetFetchContext
     * @return
     * @throws Exception
     */
    public DBFetchResult fetchDefault(IDEDataSetFetchContext iDEDataSetFetchContext) throws Exception {

        DBFetchResult dbFetchResult =  doServiceFetchWork(iDEDataSetFetchContext,DATASET_DEFAULT,false);
        // dbFetchResult.getDataSet().cacheDataRow();
        // session.close();
        return dbFetchResult;
    }







    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onFillParentInfo(net.ibizsys.paas.entity.IEntity, java.lang.String, java.lang.String, java.lang.String)
     */
    @Override
    protected void onFillParentInfo(IBZ5ACCOUNT et,String strParentType,String strTypeParam,String strParentKey) throws Exception {
        //关系类型 : DER11 ,主实体 :IBZ5CUSTOMER / 客户
        if (((StringHelper.compare(strParentType, WebContext.PARAM_PARENTTYPE_DER1N, true) == 0)
                ||(StringHelper.compare(strParentType, WebContext.PARAM_PARENTTYPE_SYSDER1N, true) == 0)
                ||(StringHelper.compare(strParentType, WebContext.PARAM_PARENTTYPE_DER11, true) == 0)
                ||(StringHelper.compare(strParentType, WebContext.PARAM_PARENTTYPE_SYSDER11, true) == 0))
                && (StringHelper.compare(strTypeParam, "DER11_IBZ5ACCOUNT_IBZ5CUSTOMER", true)==0)) {
            IService iService= ServiceGlobal.getService("com.sa.ibiz.demo.srv.demo.service.IBZ5CUSTOMERService",this.getSessionFactory());
            com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity = ( com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER)iService.getDEModel().createEntity();
            parentEntity.set(com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER.FIELD_IBZ5CUSTOMERID,DataTypeHelper.parse(25,strParentKey));
            if(strParentKey.indexOf(ServiceBase.TEMPKEY) == 0)
                iService.getTemp(parentEntity);
            else
                iService.get(parentEntity);
            this.onFillParentInfo_IBZ5CUSTOMER(et,parentEntity );
            return;
        }
        super.onFillParentInfo(et,strParentType,strTypeParam,strParentKey);
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onSyncDER1NData(java.lang.String, java.lang.String, java.lang.String)
     */
    @Override
    protected String onSyncDER1NData(String strDER1NId, String strParentKey, String strDatas) throws Exception {
        return super.onSyncDER1NData( strDER1NId,  strParentKey,  strDatas);
    }


    /**
    * 填充数据的父数据信息[客户]
    * @param et 当前数据对象
    * @param parentEntity 父数据对象
    * @throws Exception
    */
    protected void onFillParentInfo_IBZ5CUSTOMER(IBZ5ACCOUNT et,com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity) throws Exception {
        et.setIBZ5ACCOUNTId(parentEntity.getIBZ5CUSTOMERId());
    }




    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onFillEntityFullInfo(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onFillEntityFullInfo(IBZ5ACCOUNT et, boolean bCreate) throws Exception {
        //填充新建默认值
        if(bCreate) {
        }
        super.onFillEntityFullInfo(et, bCreate);

        //填充物理化外键相关属性
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onWriteBackParent(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onWriteBackParent(IBZ5ACCOUNT et, boolean bCreate) throws Exception {
        super.onWriteBackParent(et, bCreate);
    }




    /**
     * 通过关系[客户]父数据查询数据
     * @param parentEntity 父数据
     * @throws Exception
     */
    public java.util.ArrayList<IBZ5ACCOUNT> selectByIBZ5CUSTOMER(com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity) throws Exception {
        return selectByIBZ5CUSTOMER(parentEntity,"");
    }
    /**
     * 通过关系[客户]父数据查询数据
     * @param parentEntity 父数据
     * @param strOrderInfo 排序信息
     * @throws Exception
     */
    public java.util.ArrayList<IBZ5ACCOUNT> selectByIBZ5CUSTOMER(com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity,String strOrderInfo) throws Exception {
        SelectCond selectCond = new SelectCond();
        selectCond.setConditon(IBZ5ACCOUNT.FIELD_IBZ5ACCOUNTID, parentEntity.getIBZ5CUSTOMERId());
        selectCond.setOrderInfo(strOrderInfo);
        onFillSelectByIBZ5CUSTOMERCond(selectCond);
        return this.select(selectCond);
    }

    /**
     * 填充关系[客户]父数据查询附加条件
     * @param selectCond 查询条件对象
     * @throws Exception
     */
    protected void onFillSelectByIBZ5CUSTOMERCond(SelectCond selectCond) throws Exception {

    }




    /**
     * 判断是否能够通过关系[客户]删除数据
     * @param parentEntity 父数据
     * @throws Exception
     */
    public void testRemoveByIBZ5CUSTOMER(com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity) throws Exception {
    }


    /**
     * 通过关系[客户]重置数据
     * @param parentEntity 父数据
     * @throws Exception
     */
    public void resetIBZ5CUSTOMER(com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity) throws Exception {
        java.util.ArrayList<IBZ5ACCOUNT> list =  this.selectByIBZ5CUSTOMER(parentEntity);
        for(IBZ5ACCOUNT item:list) {
            IBZ5ACCOUNT item2 = (IBZ5ACCOUNT)getDEModel().createEntity();
            item2.setIBZ5ACCOUNTId(item.getIBZ5ACCOUNTId());
            item2.setIBZ5ACCOUNTId(null);
            this.update(item2);
        }
    }


    /**
     * 通过关系[客户]删除数据
     * @param parentEntity 父数据
     * @throws Exception
     */
    public void removeByIBZ5CUSTOMER(com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity) throws Exception {
        final com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity2 = parentEntity;
        this.doServiceWork(new IServiceWork() {
            @Override
            public void execute(ITransaction iTransaction) throws Exception {
                onBeforeRemoveByIBZ5CUSTOMER(parentEntity2);
                internalRemoveByIBZ5CUSTOMER(parentEntity2);
                onAfterRemoveByIBZ5CUSTOMER(parentEntity2);
            }
        });
    }

    /**
     * 通过关系[客户]删除数据之前调用
     * @param parentEntity 父数据
     * @throws Exception
     */
    protected void onBeforeRemoveByIBZ5CUSTOMER(com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity) throws Exception {

    }

    /**
    * 内部删除数据，通过关系[客户]
    * @param parentEntity 父数据
    * @throws Exception
    */
    protected void internalRemoveByIBZ5CUSTOMER(com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity) throws Exception {
        java.util.ArrayList<IBZ5ACCOUNT> removeList = selectByIBZ5CUSTOMER(parentEntity);
        onBeforeRemoveByIBZ5CUSTOMER(parentEntity,removeList );

        // 执行删除
        for (IBZ5ACCOUNT item : removeList ) {
            remove(item );
        }
        onAfterRemoveByIBZ5CUSTOMER(parentEntity,removeList );
    }

    /**
     * 通过关系[客户]删除数据之后调用
     * @param parentEntity 父数据
     * @throws Exception
     */
    protected void onAfterRemoveByIBZ5CUSTOMER(com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity) throws Exception {

    }

    /**
     * 通过关系[客户]删除数据之前调用
     * @param parentEntity 父数据
     * @param removeList 要删除的数据清单
     * @throws Exception
     */
    protected void onBeforeRemoveByIBZ5CUSTOMER(com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity,java.util.ArrayList<IBZ5ACCOUNT> removeList) throws Exception {

    }

    /**
     * 通过关系[客户]删除数据之后调用
     * @param parentEntity 父数据
     * @param removeList 要删除的数据清单
     * @throws Exception
     */
    protected void onAfterRemoveByIBZ5CUSTOMER(com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER parentEntity,java.util.ArrayList<IBZ5ACCOUNT> removeList) throws Exception {

    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onBeforeRemove(net.ibizsys.paas.entity.IEntity)
     */
    @Override
    protected void onBeforeRemove(IBZ5ACCOUNT et) throws Exception {
        super.onBeforeRemove(et);
    }





    /**
     * 替换父数据信息
     * @param et
     * @throws Exception
     */
    @Override
    protected void replaceParentInfo(IBZ5ACCOUNT et,CloneSession cloneSession) throws Exception {
        super.replaceParentInfo(et, cloneSession);
        //循环所有的从关系，判断有误替换
        if(et.getIBZ5ACCOUNTId()!=null) {
            IEntity entity = cloneSession.getEntity("IBZ5CUSTOMER",et.getIBZ5ACCOUNTId());
            if(entity !=null) {
                onFillParentInfo_IBZ5CUSTOMER(et,(com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER) entity);
            }
        }
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onRemoveEntityUncopyValues(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onRemoveEntityUncopyValues(IBZ5ACCOUNT et, boolean bTempMode) throws Exception {
        super.onRemoveEntityUncopyValues(et,  bTempMode);
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onCheckEntity(boolean, net.ibizsys.paas.entity.IEntity, boolean, boolean, net.ibizsys.paas.entity.EntityError)
     */
    @Override
    protected void onCheckEntity(boolean bBaseMode,IBZ5ACCOUNT  et, boolean bCreate, boolean bTempMode,EntityError entityError) throws Exception {
        EntityFieldError entityFieldError = null;
        //检查属性 开户银行号
        entityFieldError = onCheckField_BANKACCOUNTNUM( bBaseMode,  et,  bCreate,  bTempMode);
        if(entityFieldError!=null) {
            entityError.register(entityFieldError);
        }
        //检查属性 开户行
        entityFieldError = onCheckField_BANKNAME( bBaseMode,  et,  bCreate,  bTempMode);
        if(entityFieldError!=null) {
            entityError.register(entityFieldError);
        }
        //检查属性 账户标识
        entityFieldError = onCheckField_IBZ5ACCOUNTId( bBaseMode,  et,  bCreate,  bTempMode);
        if(entityFieldError!=null) {
            entityError.register(entityFieldError);
        }
        //检查属性 账户名称
        entityFieldError = onCheckField_IBZ5ACCOUNTName( bBaseMode,  et,  bCreate,  bTempMode);
        if(entityFieldError!=null) {
            entityError.register(entityFieldError);
        }
        super.onCheckEntity(bBaseMode,et,  bCreate,bTempMode,entityError);
    }


    /**
     * 获取属性[BANKACCOUNTNUM]值错误
     * @param bBaseMode 是否为基本检查模式，基本检查模式执行值类型，长度及属性值规则检查，非基本模式进行重复值检查
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据
     * @param bTempMode 是否为临时数据模式
     * @throws Exception
     */
    protected EntityFieldError onCheckField_BANKACCOUNTNUM(boolean bBaseMode,IBZ5ACCOUNT et, boolean bCreate, boolean bTempMode) throws Exception {
        //判断是否有值
        if(!et.isBANKACCOUNTNUMDirty())
            return null;

        String value = et.getBANKACCOUNTNUM();
        if(bBaseMode) {
            if(bCreate) {
            }

            String strRuleInfo  = null;
            //检查值规则[默认规则]
            strRuleInfo =onTestValueRule_BANKACCOUNTNUM_Default( et,  bCreate,  bTempMode);
            if(!StringHelper.isNullOrEmpty(strRuleInfo)) {
                EntityFieldError entityFieldError = new EntityFieldError();
                entityFieldError.setFieldName(IBZ5ACCOUNT.FIELD_BANKACCOUNTNUM);
                entityFieldError.setErrorType(EntityFieldError.ERROR_VALUERULE);
                entityFieldError.setErrorInfo(strRuleInfo);
                return entityFieldError;
            }
        } else {
        }
        return null;
    }


    /**
     * 获取属性[BANKNAME]值错误
     * @param bBaseMode 是否为基本检查模式，基本检查模式执行值类型，长度及属性值规则检查，非基本模式进行重复值检查
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据
     * @param bTempMode 是否为临时数据模式
     * @throws Exception
     */
    protected EntityFieldError onCheckField_BANKNAME(boolean bBaseMode,IBZ5ACCOUNT et, boolean bCreate, boolean bTempMode) throws Exception {
        //判断是否有值
        if(!et.isBANKNAMEDirty())
            return null;

        String value = et.getBANKNAME();
        if(bBaseMode) {
            if(bCreate) {
            }

            String strRuleInfo  = null;
            //检查值规则[默认规则]
            strRuleInfo =onTestValueRule_BANKNAME_Default( et,  bCreate,  bTempMode);
            if(!StringHelper.isNullOrEmpty(strRuleInfo)) {
                EntityFieldError entityFieldError = new EntityFieldError();
                entityFieldError.setFieldName(IBZ5ACCOUNT.FIELD_BANKNAME);
                entityFieldError.setErrorType(EntityFieldError.ERROR_VALUERULE);
                entityFieldError.setErrorInfo(strRuleInfo);
                return entityFieldError;
            }
        } else {
        }
        return null;
    }


    /**
     * 获取属性[IBZ5ACCOUNTId]值错误
     * @param bBaseMode 是否为基本检查模式，基本检查模式执行值类型，长度及属性值规则检查，非基本模式进行重复值检查
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据
     * @param bTempMode 是否为临时数据模式
     * @throws Exception
     */
    protected EntityFieldError onCheckField_IBZ5ACCOUNTId(boolean bBaseMode,IBZ5ACCOUNT et, boolean bCreate, boolean bTempMode) throws Exception {
        //判断是否有值
        if(!et.isIBZ5ACCOUNTIdDirty())
            return null;

        String value = et.getIBZ5ACCOUNTId();
        if(bBaseMode) {
            if(bCreate) {
                if(StringHelper.isNullOrEmpty(value)) {
                    EntityFieldError entityFieldError = new EntityFieldError();
                    entityFieldError.setFieldName(IBZ5ACCOUNT.FIELD_IBZ5ACCOUNTID);
                    entityFieldError.setErrorType(EntityFieldError.ERROR_EMPTY);
                    return entityFieldError;
                }
            }

            String strRuleInfo  = null;
            //检查值规则[默认规则]
            strRuleInfo =onTestValueRule_IBZ5ACCOUNTId_Default( et,  bCreate,  bTempMode);
            if(!StringHelper.isNullOrEmpty(strRuleInfo)) {
                EntityFieldError entityFieldError = new EntityFieldError();
                entityFieldError.setFieldName(IBZ5ACCOUNT.FIELD_IBZ5ACCOUNTID);
                entityFieldError.setErrorType(EntityFieldError.ERROR_VALUERULE);
                entityFieldError.setErrorInfo(strRuleInfo);
                return entityFieldError;
            }
        } else {
        }
        return null;
    }


    /**
     * 获取属性[IBZ5ACCOUNTName]值错误
     * @param bBaseMode 是否为基本检查模式，基本检查模式执行值类型，长度及属性值规则检查，非基本模式进行重复值检查
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据
     * @param bTempMode 是否为临时数据模式
     * @throws Exception
     */
    protected EntityFieldError onCheckField_IBZ5ACCOUNTName(boolean bBaseMode,IBZ5ACCOUNT et, boolean bCreate, boolean bTempMode) throws Exception {
        //判断是否有值
        if(!et.isIBZ5ACCOUNTNameDirty())
            return null;

        String value = et.getIBZ5ACCOUNTName();
        if(bBaseMode) {
            if(bCreate) {
            }

            String strRuleInfo  = null;
            //检查值规则[默认规则]
            strRuleInfo =onTestValueRule_IBZ5ACCOUNTName_Default( et,  bCreate,  bTempMode);
            if(!StringHelper.isNullOrEmpty(strRuleInfo)) {
                EntityFieldError entityFieldError = new EntityFieldError();
                entityFieldError.setFieldName(IBZ5ACCOUNT.FIELD_IBZ5ACCOUNTNAME);
                entityFieldError.setErrorType(EntityFieldError.ERROR_VALUERULE);
                entityFieldError.setErrorInfo(strRuleInfo);
                return entityFieldError;
            }
        } else {
        }
        return null;
    }




    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onSyncEntity(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onSyncEntity(IBZ5ACCOUNT et, boolean bRemove) throws Exception {
        super.onSyncEntity( et,  bRemove);
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onSyncIndexEntities(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onSyncIndexEntities(IBZ5ACCOUNT et,boolean bRemove) throws Exception {
        super.onSyncIndexEntities(et,bRemove);
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#getDataContextValue(net.ibizsys.paas.entity.IEntity, java.lang.String, net.ibizsys.paas.service.IDataContextParam)
     */
    @Override
    public Object getDataContextValue(IBZ5ACCOUNT et,String strField,IDataContextParam iDataContextParam)throws Exception {
        Object objValue = null;
        if(iDataContextParam!=null) {
        }

        objValue = super.getDataContextValue(et,strField,iDataContextParam);
        if(objValue!=null)
            return objValue;

        return null;
    }



    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onTestValueRule(java.lang.String, java.lang.String, net.ibizsys.paas.entity.IEntity, boolean, boolean)
     */
    @Override
    protected String onTestValueRule(String strDEFieldName,String strRule,IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        if((StringHelper.compare(strDEFieldName,IBZ5ACCOUNT.FIELD_CREATEMAN,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_CreateMan_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ACCOUNT.FIELD_BANKACCOUNTNUM,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_BANKACCOUNTNUM_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ACCOUNT.FIELD_UPDATEDATE,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_UpdateDate_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ACCOUNT.FIELD_IBZ5ACCOUNTNAME,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_IBZ5ACCOUNTName_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ACCOUNT.FIELD_UPDATEMAN,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_UpdateMan_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ACCOUNT.FIELD_BANKNAME,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_BANKNAME_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ACCOUNT.FIELD_CREATEDATE,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_CreateDate_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ACCOUNT.FIELD_IBZ5ACCOUNTID,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_IBZ5ACCOUNTId_Default(et,bCreate,bTempMode);

        return super.onTestValueRule( strDEFieldName, strRule, et,bCreate, bTempMode);
    }

    /**
     * 判断值规则[建立人][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_CreateMan_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("CREATEMAN", et, bTempMode,null,false,60,true,"内容长度必须小于等于[60]")))
                return null;
            return "内容长度必须小于等于[60]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[开户银行号][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_BANKACCOUNTNUM_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("BANKACCOUNTNUM", et, bTempMode,null,false,100,true,"内容长度必须小于等于[100]")))
                return null;
            return "内容长度必须小于等于[100]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[更新时间][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_UpdateDate_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        return null;
    }

    /**
     * 判断值规则[账户名称][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_IBZ5ACCOUNTName_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("IBZ5ACCOUNTNAME", et, bTempMode,null,false,200,true,"内容长度必须小于等于[200]")))
                return null;
            return "内容长度必须小于等于[200]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[更新人][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_UpdateMan_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("UPDATEMAN", et, bTempMode,null,false,60,true,"内容长度必须小于等于[60]")))
                return null;
            return "内容长度必须小于等于[60]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[开户行][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_BANKNAME_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("BANKNAME", et, bTempMode,null,false,200,true,"内容长度必须小于等于[200]")))
                return null;
            return "内容长度必须小于等于[200]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[建立时间][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_CreateDate_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        return null;
    }

    /**
     * 判断值规则[账户标识][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_IBZ5ACCOUNTId_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("IBZ5ACCOUNTID", et, bTempMode,null,false,100,true,"内容长度必须小于等于[100]")))
                return null;
            return "内容长度必须小于等于[100]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }



    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onMergeChild(java.lang.String, java.lang.String, net.ibizsys.paas.entity.IEntity)
     */
    @Override
    protected boolean onMergeChild(String strChildType, String strTypeParam, IBZ5ACCOUNT et) throws Exception {
        boolean bRet = false;
        if(super.onMergeChild( strChildType, strTypeParam,  et))
            bRet = true;
        return bRet;
    }



    /**
     * 更新父数据
     * @param et
     * @throws Exception
     */
    @Override
    protected void onUpdateParent(IBZ5ACCOUNT et)throws Exception {
        super.onUpdateParent(et);
    }


}